<template>
    <el-form class="msgEditForm" ref="msgInfo" :inline="true" :model="msgInfo" label-width="80px">
                    <el-form-item :label="$t('system.msg.msgType')">
                        <el-select v-model="msgInfo.msgType" style="width: 92%;" multiple :placeholder="$t('common.selectTips')">
                            <el-option
                                    v-for="item in options.msgType"
                                    :key="item.dictKey"
                                    :label="item.dictValue"
                                    :value="item.dictKey">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item :label="$t('system.msg.msgSender')">
                        <el-input v-model="msgInfo.msgSender"></el-input>
                    </el-form-item>
                    <el-form-item :label="$t('system.msg.msgReceiver')">
                        <el-input v-model="msgInfo.msgReceiver"></el-input>
                    </el-form-item>
                    <el-form-item :label="$t('system.msg.msgCode')">
                        <el-input v-model="msgInfo.msgCode"></el-input>
                    </el-form-item>
                    <el-form-item :label="$t('system.msg.msgTitle')">
                        <el-input v-model="msgInfo.msgTitle"></el-input>
                    </el-form-item>
                    <el-form-item :label="$t('system.msg.msgContent')">
                        <el-input v-model="msgInfo.msgContent"></el-input>
                    </el-form-item>
                    <el-form-item :label="$t('system.msg.msgStatus')">
                        <el-select v-model="msgInfo.msgStatus" style="width: 92%;" multiple :placeholder="$t('common.selectTips')">
                            <el-option
                                    v-for="item in options.msgStatus"
                                    :key="item.dictKey"
                                    :label="item.dictValue"
                                    :value="item.dictKey">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item :label="$t('system.msg.msgContentHtml')">
                        <el-input v-model="msgInfo.msgContentHtml"></el-input>
                    </el-form-item>
    </el-form>
</template>
<script>
    import request from '@/utils/request'
    export default {
        name: 'msgEdit',
        props: ['msgInfo'],
        data() {
            return {
                //所有的下拉选项
                options:{
                    msgType: [],
                    msgStatus: [],
                }
            }
        },
        watch: {
            msgInfo: function(val) {

            }
        },
        //页面初始化加载
        created() {
            this.getMsgType();
            this.getMsgStatus();
        },
        methods: {
            getMsgType() {
                request({
                    url: '/system/dict/query?dictGroupKey=msgType',
                    method: 'post'
                }).then(response => {
                    this.options["msgType"] = response.data;
                })
            },
            getMsgStatus() {
                request({
                    url: '/system/dict/query?dictGroupKey=msgStatus',
                    method: 'post'
                }).then(response => {
                    this.options["msgStatus"] = response.data;
                })
            },
        }
    }
</script>
<style>
    .msgEditForm .el-form-item {
        width: 45%;
    }

    .msgEditForm .el-input {
        width: 100%;
    }
</style>
